/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Servlet;

import com.mysql.jdbc.Connection;
import java.sql.*;
import javax.swing.JOptionPane;

/**
 *
 * @author Brian
 */
public class dataBaseController
{
    private static Connection con = null;

    private dataBaseController()
    {}
      public static Connection getConnection()
    {
        if(con == null){
        try
        {
            Class.forName("com.mysql.jdbc.Driver");

           con=(Connection)DriverManager.getConnection("jdbc:mysql://mysql1.cs.stonybrook.edu:3306/brchung","brchung","106747535");
           //con=(Connection)DriverManager.getConnection("jdbc:mysql://SQL09.FREEMYSQL.NET:3306","wow123","123456");


        }
        catch(SQLException ex)
        {
            System.out.print("SQL Exception!");
        }
        catch(ClassNotFoundException ex)
        {
            System.out.print("Class Not Found Exception!");
        }}
        

        {return con;}
    }
    
}
